﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Bugs.aspx.cs" Inherits="smallDeimos.Bugs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Small Deimos - Bugs</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        List of bugs and features for SmallDeimos.<br />
        <br />
        Click <a href="AddBug.aspx">here</a> to add bug report.
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
            DataKeyNames="BugId" DataSourceID="BugsDatasource">
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <RowStyle ForeColor="#000066" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="BugId" HeaderText="BugId" InsertVisible="False" 
                    ReadOnly="True" SortExpression="BugId" />
                <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
                <asp:BoundField DataField="Comments" HeaderText="Comments" 
                    SortExpression="Comments" />
                <asp:BoundField DataField="Status" HeaderText="Status" 
                    SortExpression="Status" />
                <asp:BoundField DataField="LastModification" HeaderText="LastModification" 
                    SortExpression="LastModification" />
            </Columns>
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <EmptyDataTemplate>
                No bugs reported.
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="BugsDatasource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>" 
            DeleteCommand="DELETE FROM [Bugs] WHERE [BugId] = @BugId" 
            InsertCommand="INSERT INTO [Bugs] ([Comments], [Status], [LastModification]) VALUES (@Comments, @Status, @LastModification)" 
            SelectCommand="SELECT * FROM [Bugs] ORDER BY [LastModification] DESC" 
            UpdateCommand="UPDATE [Bugs] SET [Comments] = @Comments, [Status] = @Status, [LastModification] = getdate() WHERE [BugId] = @BugId">
            <DeleteParameters>
                <asp:Parameter Name="BugId" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Comments" Type="String" />
                <asp:Parameter Name="Status" Type="String" />
                <asp:Parameter Name="LastModification" Type="DateTime" />
                <asp:Parameter Name="BugId" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Comments" Type="String" />
                <asp:Parameter Name="Status" Type="String" />
                <asp:Parameter Name="LastModification" Type="DateTime" />
            </InsertParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
